<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>layout布局页面</title>
		<script type="text/javascript" src="../../jquery-1.8.3.js"></script>
		<script type="text/javascript" src="../jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../locale/easyui-lang-zh_CN.js"></script>
		<script type="text/javascript" src="../../ztree/jquery.ztree.all-3.5.js"></script>
		<link rel="stylesheet" href="../themes/default/easyui.css" />
		<link rel="stylesheet" href="../themes/icon.css" />
		<link rel="stylesheet" href="../../ztree/zTreeStyle.css" />
		<script type="text/javascript">
			$(function() {

				var setting = {
					data: {
						simpleData: {
							enable: true,
							idKey: "id",
							pIdKey: "pId",
						}
					},
					callback: {
						onClick: function(event, treeId, treeNode, clickFlag) {
							var content = '<div style="width:100%;height:100%;overflow:hidden;">'
								+ '<iframe src="'
								+ treeNode.page
								+ '" scrolling="auto" style="width:100%;height:100%;border:0;" ></iframe></div>';
							//alert(treeNode.name+"   "+treeNode.page);
							if(treeNode.name != "" && treeNode.name != undefined) {
								//如果选项卡存在,那么就选中
								if($("#mytabs").tabs("exists", treeNode.name)) {
									$("#mytabs").tabs("select", treeNode.name);
								}
								//如果选项卡不存在,就添加选项卡
								else {
									$('#mytabs').tabs('add', {
										title: treeNode.name,	//节点名
										content: content,	//直接定义treeNode.page属性连接是文本形式,不行
										closable: true
									});
								}
							}
						}
					}
				};
				var zNodes = [
					{ id: 1, pId: 0, name: "父节点一" },
					{ id: 2, pId: 0, name: "父节点二" },
					{ id: 11, pId: 1, name: "子节点一" },
					{ id: 12, pId: 1, name: "子节点二" },
					{ id: 13, pId: 2, name: "传智播客", page: "http://www.itcast.cn" },
					{ id: 14, pId: 2, name: "百度", page: "http://www.baidu.com" }
				];

				$(document).ready(function() {
					$.fn.zTree.init($("#tree"), setting, zNodes);
				});

			})
		</script>
	</head>

	<body class="easyui-layout">

		<div data-options="region:'north',title:'传智播客管理系统'" style="height: 100px;">北部区域</div>
		<div data-options="region:'west'" style="width: 200px;">
			<div id="myaccordion" class="easyui-accordion" data-options="fit:true" style="width:300px;height:200px;">
				<div title="基本功能" data-options="iconCls:'icon-save'" style="overflow:auto;padding:10px;">
					<ul id="tree" class="ztree" style="width:260px; overflow:auto;"></ul>
				</div>
				<div title="系统管理" data-options="iconCls:'icon-reload',selected:true" style="padding:10px;">
					系统管理
				</div>
			</div>
		</div>
		<div data-options="region:'center'">
			<div id="mytabs" class="easyui-tabs" data-options="fit:true" style="width:500px;height:250px;">
				<div title="消息中心" style="padding:20px;display:none;">
				</div>
				<div title="消息中心1" data-options="closable:true">
				</div>
				<div title="消息中心2" data-options="iconCls:'icon-reload',closable:true">
				</div>
			</div>
		</div>
		<div data-options="region:'east'" style="width: 80px;">东部区域</div>
		<div data-options="region:'south'" style="height: 80px;">南部区域</div>
	</body>

</html>